package com.travelsmart.client.apresentacao.view.subview;

import com.google.gwt.user.client.ui.Grid;
import com.google.gwt.user.client.ui.HTML;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.travelsmart.client.apresentacao.controller.Observer;
import com.travelsmart.client.apresentacao.i18n.I18nMessages;
import com.travelsmart.client.apresentacao.view.BaseView;
import com.travelsmart.client.bean.to.QuartoTO;

public class ViewDadosRoom extends BaseView implements Observer<QuartoTO>{
	private final VerticalPanel vPanelViewDadosRoom = new VerticalPanel();;
	public ViewDadosRoom(HTML nome) {
		super(nome);
		initWidget(vPanelViewDadosRoom);
	}
	
	public void exec( final QuartoTO quarto){
		vPanelViewDadosRoom.clear();
		Grid dadosRoom = new Grid(4, 2);
		dadosRoom.setHTML(0, 0, I18nMessages.INSTANCE.quarto2() + ":");
		dadosRoom.setHTML(0, 1, quarto.getNome());
		dadosRoom.setHTML(1, 0, I18nMessages.INSTANCE.informacao() + ":");
		dadosRoom.setHTML(1, 1, quarto.getInfo());
		dadosRoom.setHTML(2, 0, I18nMessages.INSTANCE.preco() + ":");
		Grid precoRoom = new Grid(2, 2);
		precoRoom.setHTML(0, 0, I18nMessages.INSTANCE.preco_medio_diaria());
		precoRoom.setHTML(0, 1, quarto.getPrecoString());
		precoRoom.setHTML(1, 0, I18nMessages.INSTANCE.impostos_tarifas()
				+ ":");
		precoRoom.setHTML(1, 1, quarto.getPrecoString());
		dadosRoom.setWidget(2, 1, precoRoom);
		dadosRoom.setHTML(3, 0, I18nMessages.INSTANCE.descricao() + ":");
		dadosRoom.setHTML(3, 1, quarto.getDescricao());
		
		vPanelViewDadosRoom.add(nome);
		vPanelViewDadosRoom.add(dadosRoom);
		
	}

	@Override
	public void update(QuartoTO arg) {
		exec(arg);
		
	}

}


